package com.htc.android.footprints.utils.voice;

import java.io.File;
import java.io.IOException;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;
import android.util.Log;

public class FootprintVoiceManager
{
  private static final boolean DEBUG = true;
  static final String MIME_TYPE = "audio/amr";
  private static final String TAG = "FootprintImageManager";
  private static FootprintVoiceManager sInstance = null;

  private static boolean checkFsWritable()
  {
    String str = Environment.getExternalStorageDirectory().toString() + "/.footprints/voices";
    File localFile1 = new File(str);
    int i;
    if ((!localFile1.isDirectory()) && (!localFile1.mkdirs()))
      i = 0;
    while (true)
    {
      return i;
      File localFile2 = new File(str, ".probe");
      try
      {
        if (localFile2.exists())
          localFile2.delete();
        if (!localFile2.createNewFile())
        {
          i = 0;
          continue;
        }
        localFile2.delete();
        i = 1;
      }
      catch (IOException localIOException)
      {
        i = 0;
      }
    }
  }

  public static String getDirectory()
  {
    return Environment.getExternalStorageDirectory() + "/.footprints/voices";
  }

  public static FootprintVoiceManager getInstance()
  {
    if (sInstance == null)
      sInstance = new FootprintVoiceManager();
    return sInstance;
  }

  public static boolean hasStorage()
  {
    return hasStorage(true);
  }

  public static boolean hasStorage(boolean paramBoolean)
  {
    String str = Environment.getExternalStorageState();
    Log.d("FootprintImageManager", "state is " + str);
    boolean bool1;
    if ("mounted".equals(str))
      if (paramBoolean)
      {
        boolean bool2 = checkFsWritable();
        Log.d("FootprintImageManager", "writable is " + bool2);
        bool1 = bool2;
      }
    while (true)
    {
      return bool1;
      bool1 = true;
      continue;
      if ((!paramBoolean) && ("mounted_ro".equals(str)))
      {
        bool1 = true;
        continue;
      }
      bool1 = false;
    }
  }

  public static Cursor query(Context paramContext, Uri paramUri, String[] paramArrayOfString1, String paramString1, String[] paramArrayOfString2, String paramString2)
  {
    Object localObject;
    try
    {
      ContentResolver localContentResolver = paramContext.getContentResolver();
      if (localContentResolver == null)
      {
        localObject = null;
      }
      else
      {
        Cursor localCursor = localContentResolver.query(paramUri, paramArrayOfString1, paramString1, paramArrayOfString2, paramString2);
        localObject = localCursor;
      }
    }
    catch (UnsupportedOperationException localUnsupportedOperationException)
    {
      localObject = null;
    }
    return localObject;
  }
}

/* Location:           E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:     com.htc.android.footprints.utils.voice.FootprintVoiceManager
 * JD-Core Version:    0.6.0
 */